<?php

class CDBBase {
	
	protected $_dbConfig;
	
	protected $_isProc;
	
	function __construct($dbConfigKey) {
		$this->_dbConfig = Config::get("db.".$dbConfigKey,"");
		if (!is_array($this->_dbConfig)||!isset($this->_dbConfig['dbHost'])||!isset($this->_dbConfig['dbName'])||!isset($this->_dbConfig['dbUser'])||!isset($this->_dbConfig['dbPwd']))
		{
            CError::handler(E_ERROR,"数据库配置信息错误！",__FILE__,__LINE__);
		}
		//$this->connect();
	}
	
	public function setProcFlag($isProc)
	{
		$this->_isProc = $isProc;
	}
	
	protected function errorMsg($msg,$error=E_ERROR)
	{
		//throw new Exception("执行错误",E_ERROR);
		CError::handler($error,$msg,__FILE__,__LINE__);
	}
	
	protected function errorMsgAndThrow($msg)
	{
		$sqlErrorCode = $msg[0];
		$driverErrorCode = $msg[1];
		$driverErrorMsg = $msg[2];

		throw new Exception($driverErrorMsg,E_ERROR);
	}
	//abstract function connect();
}

?>